Interface java.io.DataInput
All Packages Class Hierarchy This Package Previous Next Index
Interface java.io.DataInput
- public interface DataInput
The data input interface is implemented by streams that can read
primitive Java data types from a stream in a machine-independent
manner.
- Version:
- 1.9, 07/01/98
- Author:
- Frank Yellin
- Since:
- JDK1.0
- See Also:
- DataInputStream, DataOutput
-
readBoolean()
- Reads a
boolean
value from the input stream.
-
readByte()
- Reads a signed 8-bit value from the input stream.
-
readChar()
- Reads a Unicode
char
value from the input stream.
-
readDouble()
- Reads a
double
value from the input stream.
-
readFloat()
- Reads a
float
value from the input stream.
-
readFully(byte[])
- Reads
b.length
bytes into the byte array.
-
readFully(byte[], int, int)
- Reads
b.length
bytes into the byte array.
-
readInt()
- Reads an
int
value from the input stream.
-
readLine()
- Reads the next line of text from the input stream.
-
readLong()
- Reads a
long
value from the input stream.
-
readShort()
- Reads a 16-bit value from the input stream.
-
readUTF()
- Reads in a string that has been encoded using a modified UTF-8 format.
-
readUnsignedByte()
- Reads an unsigned 8-bit value from the input stream.
-
readUnsignedShort()
- Reads an unsigned 16-bit value from the input stream.
-
skipBytes(int)
- Skips exactly
n
bytes of input.
readBoolean
public abstract boolean readBoolean() throws IOException
- Reads a
boolean
value from the input stream.
- Returns:
- the
boolean
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readByte
public abstract byte readByte() throws IOException
- Reads a signed 8-bit value from the input stream.
- Returns:
- the 8-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readChar
public abstract char readChar() throws IOException
- Reads a Unicode
char
value from the input stream.
- Returns:
- the Unicode
char
read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readDouble
public abstract double readDouble() throws IOException
- Reads a
double
value from the input stream.
- Returns:
- the
double
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readFloat
public abstract float readFloat() throws IOException
- Reads a
float
value from the input stream.
- Returns:
- the
float
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readFully
public abstract void readFully(byte b) throws IOException
- Reads
b.length
bytes into the byte array. This
method blocks until all the bytes are read.
- Parameters:
- b - the buffer into which the data is read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readFully
public abstract void readFully(byte b,
int off,
int len) throws IOException
- Reads
b.length
bytes into the byte array. This
method blocks until all the bytes are read.
- Parameters:
- b - the buffer into which the data is read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readInt
public abstract int readInt() throws IOException
- Reads an
int
value from the input stream.
- Returns:
- the
int
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readLine
public abstract java.lang.String readLine() throws IOException
- Reads the next line of text from the input stream.
- Returns:
- if this stream reaches the end before reading all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readLong
public abstract long readLong() throws IOException
- Reads a
long
value from the input stream.
- Returns:
- the
long
value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readShort
public abstract short readShort() throws IOException
- Reads a 16-bit value from the input stream.
- Returns:
- the 16-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readUTF
public abstract java.lang.String readUTF() throws IOException
- Reads in a string that has been encoded using a modified UTF-8 format.
For an exact description of this method, see the discussion in
Gosling, Joy, and Steele, The Java Language Specification.
- Returns:
- a Unicode string.
- Throws: EOFException
- if this stream reaches the end
before reading all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Throws: UTFDataFormatException
- if the bytes do not represent a
valid UTF-8 encoding of a string.
- Since:
- JDK1.0
readUnsignedByte
public abstract int readUnsignedByte() throws IOException
- Reads an unsigned 8-bit value from the input stream.
- Returns:
- the unsigned 8-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
readUnsignedShort
public abstract int readUnsignedShort() throws IOException
- Reads an unsigned 16-bit value from the input stream.
- Returns:
- the unsigned 16-bit value read.
- Throws: EOFException
- if this stream reaches the end before reading
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
skipBytes
public abstract int skipBytes(int n) throws IOException
- Skips exactly
n
bytes of input.
- Parameters:
- n - the number of bytes to be skipped.
- Returns:
- the number of bytes skipped, which is always
n
.
- Throws: EOFException
- if this stream reaches the end before skipping
all the bytes.
- Throws: IOException
- if an I/O error occurs.
- Since:
- JDK1.0
All Packages Class Hierarchy This Package Previous Next Index